//学员信息管理
public class StudentMsg {
    //学员数据
    String[] names = new String[30];
    //标识符
    boolean flag = false;
    //增加学员
    public void addName(String name){
        for (int i=0;i<names.length;i++){
            if (names[i] == null){
                names[i] = name;
                flag = true;
                break;
            }
        }
        if (flag){
            System.out.print("添加成功");
        }else {
            System.out.print("学员已满，添加失败");
        }
    }

    //查找学员
    public boolean searchName(int start,int end,String name){
        for (int i=start-1;i<end;i++){
            if (names[i].equals(name)){
                flag = true;
                break;
            }else {
                flag = false;
                break;
            }
        }
        return flag;
    }

    //显示学员
    public void showMsg(){
        System.out.println("\n*********学员信息**********");
        for (int i=0;i<names.length;i++){
            if (names[i] != null){
                System.out.println(names[i]+"\t");
            }
        }
    }
}
